package com.crm.util;

import java.io.FileOutputStream;
import java.io.PrintStream;

public class t {
	public static void main(String[] args) {
		 int totalpage =20;//总页数
		 int s1= 1;//起始页
		 int e1=6;//结束页
		 if(e1>totalpage) {
			 e1 = totalpage;//
		 }
		 StringBuffer  table = new StringBuffer("<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" /></head><body><table border=1><tr><td>企业名称</td></tr>");
		 for(int j=s1;j<e1;j++){   
			 table.append("<tr><td>"+j+"</td></tr>");
			 System.out.println(j);
			 if((j+1)==e1){ 
					
				 try{ 
					 table.append("</table></body></html>");
					 PrintStream printStream = new PrintStream(new FileOutputStream("d://reporttabs"+s1+".html")); 
					 printStream.println(table.toString()); 
					 System.out.println("已成功输出"+s1);
				 }catch(Exception e){
					 
				 }
				 
				 table = new StringBuffer("<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" /></head><body><table border=1><tr><td>企业名称</td></tr>");
				 s1=e1;
				 e1=s1+6;
				 if(e1>=totalpage){
					 e1 = totalpage;
				 }
				 j=s1;
			 }
		 }
		 
		 table.append("</table></body></html>");
			
		 try{ 
			 PrintStream printStream = new PrintStream(new FileOutputStream("d://reporttabs"+s1+".html")); 
			 printStream.println(table.toString()); 
			 System.out.println("已成功输出");
		 }catch(Exception e){
			 
		 }
        
	}
}
